﻿using UnityEngine;
using System.Collections;

public class Timer : MonoBehaviour 
{

    float timer = 30.0f;

	// Use this for initialization
	void Start () 
    {
	
	}
	
	// Update is called once per frame
	void Update () 
    {
        timer -= Time.deltaTime;

        if(timer <= 0)
        {
            timer = 0.0f;
            Application.LoadLevel("Scene_End");
        }
	}

    void OnGUI()
    {
        GUI.Box(new Rect(Screen.width/2, 10, 100, 35), "" + timer.ToString("0"));
    }
}
